import { FMVCS } from "../../../fgui/fmvc/FMVCS";
import PlayerCtrl from "../../player/PlayerCtrl";

export default class MapItem extends FMVCS.FView {
    /** 编号 */
    index: number = -1;
    /** 房主昵称 */
    userName: string = ``;
    /** 地图名称 */
    mapName: string = ``;
    clickHandlers(){
        return [

        ];
    }

    onFlush(type: string = `all`){
        switch(type){
            case `all`: {
                this._updateLblMapName();
                this._updateLblUserName();
                this._updateDefaultIcon();
                break;
            }
        }
    }

    private _updateLblMapName(){
        this._views[`lblMapName`].asLabel.text = this.mapName;
    }

    private _updateLblUserName(){
        this._views[`lblUserName`].asLabel.text = `房主: ` + this.userName;
    }

    private _updateDefaultIcon(){
        this._views[`defaultIcon`].visible = !PlayerCtrl.data.vo.icon;
    }
}
